﻿

namespace SLS.ExClassLib.WFActivities
{
    using System.Activities;
    using System.ComponentModel;
    using SLS.ExClassLib.Data;
    using SLS.ExClassLib.MVVM;
    public sealed class ValidateJob : CodeActivity<bool>
    { 
         
       #region Properties

        /// <summary>
        ///   Gets or sets Line.
        /// </summary>
        [DefaultValue(null)]
        public InArgument<ExDataRow> VJob { get; set; }
        ExDataRow job;
         #endregion
        /// <summary>
        /// The cache metadata.
        /// </summary>
        /// <param name="metadata">
        /// The metadata.
        /// </param>
        protected override void CacheMetadata(CodeActivityMetadata metadata)
        {
            metadata.RequireExtension(typeof(IDataModel));
            metadata.AddArgument(new RuntimeArgument("VJob", typeof(ExDataRow), ArgumentDirection.In, false));
            
        }
        protected override bool Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            var vm = context.GetExtension<IDataModel>();
            job = this.VJob.Get(context);

            return vm.ValidateJob(job); ;
            
        }
    } 
}
